import {request, writeLog} from "../libs/core.js"
/**
会员登录校验逻辑
@param args{account:xxx. loginpw:xxx, vcode:xxxx}
****************************************************************/
export const signIn = async(args) => {
  const data = await request({url:'/signin/check', data:args, method:'post'});
  if (data && data.code == 0 && data.sign && localStorage) {
    localStorage.setItem('sid', data.sign);
  }
  return data;
}

export const captcha = async(args) => {
	const data = await request({url:'/captcha/image', data:args, method:'post'});
  return data;
}

export const tree = async(args) => {
	const data = await request({url:'/index/dotree', data:args, method:'post'});
  return (data && data.code == 0)? data.tree:[];
}

export const dblog = async(args) => {
	const data = await request({url:'/syslog/dolist', data:args, method:'post'});
  if (data && data.code == 0 ) {
    return data;
  }
  return false;
}